<?php

use Illuminate\Database\Seeder;

class AdminSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        factory(\App\Admin::class,1)->create();
        $admin = \App\Admin::find(1);
        $admin->name = 'admin';
        $admin->nickname = '刘通';
        $admin->save();
//        $admin->pasword = bcrypt('admin888');
//        添加站长字段
        \Spatie\Permission\Models\Role::create([
            'name'=>'zhanzhang',
            'title'=>'网站站长',
            'guard_name'=>'admin'
        ]);
//        默认admin用户为站长
        $admin->syncRoles('zhanzhang');

    }
}
